package io.renren.modules.pallettable.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import io.renren.modules.cuttingcur.entity.CuttingmachineCurdataEntity;
import io.renren.modules.m.entity.MaterialEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.modules.pallettable.entity.PallettableEntity;
import io.renren.modules.pallettable.service.PallettableService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-10-26 15:31:26
 */
@RestController
@RequestMapping("pallettable/pallettable")
public class PallettableController {
    @Autowired
    private PallettableService pallettableService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("pallettable:pallettable:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = pallettableService.queryPage(params);

        return R.ok().put("page", page);
    }





    /**
     * 信息
     */
    @RequestMapping("/info/{pid}")
    @RequiresPermissions("pallettable:pallettable:info")
    public R info(@PathVariable("pid") String pid){
		PallettableEntity pallettable = pallettableService.getById(pid);

        return R.ok().put("pallettable", pallettable);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("pallettable:pallettable:save")
    public R save(@RequestBody PallettableEntity pallettable){
		pallettableService.save(pallettable);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("pallettable:pallettable:update")
    public R update(@RequestBody PallettableEntity pallettable){
		pallettableService.updateById(pallettable);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("pallettable:pallettable:delete")
    public R delete(@RequestBody String[] pids){
		pallettableService.removeByIds(Arrays.asList(pids));

        return R.ok();
    }

}
